<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>放大镜</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        .container{
            width: 801px;
            border:1px solid black;
            display: flex;
            margin:20px auto;
        }
        .left,.right{
            width: 400px;
        }
        .left{
            border-right:1px solid black;
        }
        .top{
            position: relative;
        }
        .top .content{
            /* position: absolute; */
            display: none;
        }
        .top .show{
            display: block;
        }
        .top img{
            width: 400px;
            height: 400px;
        }
        .shadow{
            width: 200px;
            height: 200px;
            background-color: rgba(0,0,0,0.5);
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }
        .bottom{
            height: 80px;
            display: flex;
        }
        .bottom .title{
            width: 70px;
            height: 70px;
            border:5px solid #fff;
        }
        .bottom .active{
            border:5px solid orange;
        }
        .bottom img{
            width: 70px;
            height: 70px;
        }
        .right{
            width: 400px;
            height: 400px;
            overflow: hidden;
            position: relative;
            display: none;
        }
        .right img{
            width: 800px;
            height: 800px;
            position: absolute;
            display: none;
        }
        .right .show{
            display: block;
        }
        .Rshow{display: block;}
    </style>
</head>
<body>
<div class="container">
    <div class="left">
        <div class="top">
            <div class="shadow"></div>
            <div class="content show"><img src="./imgs/1.jpg" alt=""></div>
            <div class="content"><img src="./imgs/2.jpg" alt=""></div>
            <div class="content"><img src="./imgs/3.jpg" alt=""></div>
            <div class="content"><img src="./imgs/4.jpg" alt=""></div>
            <div class="content"><img src="./imgs/5.jpg" alt=""></div>
        </div>
        <div class="bottom">
            <div class="title active"><img src="./imgs/1.jpg" alt=""></div>
            <div class="title"><img src="./imgs/2.jpg" alt=""></div>
            <div class="title"><img src="./imgs/3.jpg" alt=""></div>
            <div class="title"><img src="./imgs/4.jpg" alt=""></div>
            <div class="title"><img src="./imgs/5.jpg" alt=""></div>
        </div>
    </div>
    <div class="right">
        <img class="show" src="./imgs/1.jpg" alt="">
        <img src="./imgs/2.jpg" alt="">
        <img src="./imgs/3.jpg" alt="">
        <img src="./imgs/4.jpg" alt="">
        <img src="./imgs/5.jpg" alt="">
    </div>
</div>
</body>
<script src="./jquery-1.11.1.js"></script>
<script>
$(".title").click(function(){
    $(this).addClass("active").siblings().removeClass("active")
    $(".content").eq($(this).index()).addClass("show").siblings().removeClass("show")
    $(".right").children().eq($(this).index()).addClass("show").siblings().removeClass("show")
})
$(".top").mouseenter(function(){
    $(".shadow").addClass("show")
    $(".right").addClass("Rshow")
    $(".top").mousemove(function (e) {
        var x = e.clientX - $(".top").offset().left - 100
        x = x<0?0:x
        x = x>200?200:x
        var y = e.clientY - $(".top").offset().top - 100
        y = y<0?0:y
        y = y>200?200:y
        $(".shadow").css({"left":x,"top":y})
        $(".right").children().css({"left":-x*2,"top":-y*2})
    })
})
$(".top").mouseleave(function(){
    $(".shadow").removeClass("show")
    $(".right").removeClass("Rshow")
})
</script>